home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| Python script text executable
| default (weak)
| |
98%
| file
| LaTeX document, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| gt2
| Textdatei (UNIX)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 4d 61 6e 75 61 6c | 20 74 65 78 74 20 61 6e |% Manual| text an|
|00000010| 64 20 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |d implem|entation|
|00000020| 20 62 79 20 4a 61 61 70 | 20 56 65 72 6d 65 75 6c | by Jaap| Vermeul|
|00000030| 65 6e 0a 5c 73 65 63 74 | 69 6f 6e 7b 53 74 61 6e |en.\sect|ion{Stan|
|00000040| 64 61 72 64 20 4d 6f 64 | 75 6c 65 20 5c 73 65 63 |dard Mod|ule \sec|
|00000050| 74 63 6f 64 65 7b 70 6f | 73 69 78 66 69 6c 65 7d |tcode{po|sixfile}|
|00000060| 7d 0a 5c 62 69 6d 6f 64 | 69 6e 64 65 78 7b 70 6f |}.\bimod|index{po|
|00000070| 73 69 78 66 69 6c 65 7d | 0a 5c 69 6e 64 65 78 69 |sixfile}|.\indexi|
|00000080| 69 7b 70 6f 73 69 78 7d | 7b 66 69 6c 65 20 6f 62 |i{posix}|{file ob|
|00000090| 6a 65 63 74 7d 0a 54 68 | 69 73 20 6d 6f 64 75 6c |ject}.Th|is modul|
|000000a0| 65 20 69 6d 70 6c 65 6d | 65 6e 74 73 20 73 6f 6d |e implem|ents som|
|000000b0| 65 20 61 64 64 69 74 69 | 6f 6e 61 6c 20 66 75 6e |e additi|onal fun|
|000000c0| 63 74 69 6f 6e 61 6c 69 | 74 79 20 6f 76 65 72 20 |ctionali|ty over |
|000000d0| 74 68 65 20 62 75 69 6c | 74 2d 69 6e 0a 66 69 6c |the buil|t-in.fil|
|000000e0| 65 20 6f 62 6a 65 63 74 | 73 2e 20 20 49 6e 20 70 |e object|s. In p|
|000000f0| 61 72 74 69 63 75 6c 61 | 72 2c 20 69 74 20 69 6d |articula|r, it im|
|00000100| 70 6c 65 6d 65 6e 74 73 | 20 66 69 6c 65 20 6c 6f |plements| file lo|
|00000110| 63 6b 69 6e 67 2c 20 63 | 6f 6e 74 72 6f 6c 20 6f |cking, c|ontrol o|
|00000120| 76 65 72 0a 74 68 65 20 | 66 69 6c 65 20 66 6c 61 |ver.the |file fla|
|00000130| 67 73 2c 20 61 6e 64 20 | 61 6e 20 65 61 73 79 20 |gs, and |an easy |
|00000140| 69 6e 74 65 72 66 61 63 | 65 20 74 6f 20 64 75 70 |interfac|e to dup|
|00000150| 6c 69 63 61 74 65 20 74 | 68 65 20 66 69 6c 65 20 |licate t|he file |
|00000160| 6f 62 6a 65 63 74 2e 0a | 54 68 65 20 6d 6f 64 75 |object..|The modu|
|00000170| 6c 65 20 64 65 66 69 6e | 65 73 20 61 20 6e 65 77 |le defin|es a new|
|00000180| 20 66 69 6c 65 20 6f 62 | 6a 65 63 74 2c 20 74 68 | file ob|ject, th|
|00000190| 65 20 70 6f 73 69 78 66 | 69 6c 65 20 6f 62 6a 65 |e posixf|ile obje|
|000001a0| 63 74 2e 20 20 49 74 0a | 68 61 73 20 61 6c 6c 20 |ct. It.|has all |
|000001b0| 74 68 65 20 73 74 61 6e | 64 61 72 64 20 66 69 6c |the stan|dard fil|
|000001c0| 65 20 6f 62 6a 65 63 74 | 20 6d 65 74 68 6f 64 73 |e object| methods|
|000001d0| 20 61 6e 64 20 61 64 64 | 73 20 74 68 65 20 6d 65 | and add|s the me|
|000001e0| 74 68 6f 64 73 0a 64 65 | 73 63 72 69 62 65 64 20 |thods.de|scribed |
|000001f0| 62 65 6c 6f 77 2e 20 20 | 54 68 69 73 20 6d 6f 64 |below. |This mod|
|00000200| 75 6c 65 20 6f 6e 6c 79 | 20 77 6f 72 6b 73 20 66 |ule only| works f|
|00000210| 6f 72 20 63 65 72 74 61 | 69 6e 20 66 6c 61 76 6f |or certa|in flavo|
|00000220| 72 73 20 6f 66 0a 5c 55 | 4e 49 58 7b 7d 2c 20 73 |rs of.\U|NIX{}, s|
|00000230| 69 6e 63 65 20 69 74 20 | 75 73 65 73 20 5c 63 6f |ince it |uses \co|
|00000240| 64 65 7b 66 63 6e 74 6c | 28 29 7d 20 66 6f 72 20 |de{fcntl|()} for |
|00000250| 66 69 6c 65 20 6c 6f 63 | 6b 69 6e 67 2e 0a 54 6f |file loc|king..To|
|00000260| 20 69 6e 73 74 61 6e 74 | 69 61 74 65 20 61 20 70 | instant|iate a p|
|00000270| 6f 73 69 78 66 69 6c 65 | 20 6f 62 6a 65 63 74 2c |osixfile| object,|
|00000280| 20 75 73 65 20 74 68 65 | 20 5c 63 6f 64 65 7b 6f | use the| \code{o|
|00000290| 70 65 6e 28 29 7d 20 66 | 75 6e 63 74 69 6f 6e 20 |pen()} f|unction |
|000002a0| 69 6e 0a 74 68 65 20 70 | 6f 73 69 78 66 69 6c 65 |in.the p|osixfile|
|000002b0| 20 6d 6f 64 75 6c 65 2e | 20 20 54 68 65 20 72 65 | module.| The re|
|000002c0| 73 75 6c 74 69 6e 67 20 | 6f 62 6a 65 63 74 20 6c |sulting |object l|
|000002d0| 6f 6f 6b 73 20 61 6e 64 | 20 66 65 65 6c 73 20 72 |ooks and| feels r|
|000002e0| 6f 75 67 68 6c 79 0a 74 | 68 65 20 73 61 6d 65 20 |oughly.t|he same |
|000002f0| 61 73 20 61 20 73 74 61 | 6e 64 61 72 64 20 66 69 |as a sta|ndard fi|
|00000300| 6c 65 20 6f 62 6a 65 63 | 74 2e 0a 54 68 65 20 70 |le objec|t..The p|
|00000310| 6f 73 69 78 66 69 6c 65 | 20 6d 6f 64 75 6c 65 20 |osixfile| module |
|00000320| 64 65 66 69 6e 65 73 20 | 74 68 65 20 66 6f 6c 6c |defines |the foll|
|00000330| 6f 77 69 6e 67 20 63 6f | 6e 73 74 61 6e 74 73 3a |owing co|nstants:|
|00000340| 0a 5c 72 65 6e 65 77 63 | 6f 6d 6d 61 6e 64 7b 5c |.\renewc|ommand{\|
|00000350| 69 6e 64 65 78 73 75 62 | 69 74 65 6d 7d 7b 28 69 |indexsub|item}{(i|
|00000360| 6e 20 6d 6f 64 75 6c 65 | 20 70 6f 73 69 78 66 69 |n module| posixfi|
|00000370| 6c 65 29 7d 0a 5c 62 65 | 67 69 6e 7b 64 61 74 61 |le)}.\be|gin{data|
|00000380| 64 65 73 63 7d 7b 53 45 | 45 4b 5f 53 45 54 7d 0a |desc}{SE|EK_SET}.|
|00000390| 6f 66 66 73 65 74 20 69 | 73 20 63 61 6c 63 75 6c |offset i|s calcul|
|000003a0| 61 74 65 64 20 66 72 6f | 6d 20 74 68 65 20 73 74 |ated fro|m the st|
|000003b0| 61 72 74 20 6f 66 20 74 | 68 65 20 66 69 6c 65 0a |art of t|he file.|
|000003c0| 5c 65 6e 64 7b 64 61 74 | 61 64 65 73 63 7d 0a 5c |\end{dat|adesc}.\|
|000003d0| 62 65 67 69 6e 7b 64 61 | 74 61 64 65 73 63 7d 7b |begin{da|tadesc}{|
|000003e0| 53 45 45 4b 5f 43 55 52 | 7d 0a 6f 66 66 73 65 74 |SEEK_CUR|}.offset|
|000003f0| 20 69 73 20 63 61 6c 63 | 75 6c 61 74 65 64 20 66 | is calc|ulated f|
|00000400| 72 6f 6d 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 |rom the |current |
|00000410| 70 6f 73 69 74 69 6f 6e | 20 69 6e 20 74 68 65 20 |position| in the |
|00000420| 66 69 6c 65 0a 5c 65 6e | 64 7b 64 61 74 61 64 65 |file.\en|d{datade|
|00000430| 73 63 7d 0a 5c 62 65 67 | 69 6e 7b 64 61 74 61 64 |sc}.\beg|in{datad|
|00000440| 65 73 63 7d 7b 53 45 45 | 4b 5f 45 4e 44 7d 0a 6f |esc}{SEE|K_END}.o|
|00000450| 66 66 73 65 74 20 69 73 | 20 63 61 6c 63 75 6c 61 |ffset is| calcula|
|00000460| 74 65 64 20 66 72 6f 6d | 20 74 68 65 20 65 6e 64 |ted from| the end|
|00000470| 20 6f 66 20 74 68 65 20 | 66 69 6c 65 0a 5c 65 6e | of the |file.\en|
|00000480| 64 7b 64 61 74 61 64 65 | 73 63 7d 0a 54 68 65 20 |d{datade|sc}.The |
|00000490| 70 6f 73 69 78 66 69 6c | 65 20 6d 6f 64 75 6c 65 |posixfil|e module|
|000004a0| 20 64 65 66 69 6e 65 73 | 20 74 68 65 20 66 6f 6c | defines| the fol|
|000004b0| 6c 6f 77 69 6e 67 20 66 | 75 6e 63 74 69 6f 6e 73 |lowing f|unctions|
|000004c0| 3a 0a 5c 72 65 6e 65 77 | 63 6f 6d 6d 61 6e 64 7b |:.\renew|command{|
|000004d0| 5c 69 6e 64 65 78 73 75 | 62 69 74 65 6d 7d 7b 28 |\indexsu|bitem}{(|
|000004e0| 69 6e 20 6d 6f 64 75 6c | 65 20 70 6f 73 69 78 66 |in modul|e posixf|
|000004f0| 69 6c 65 29 7d 0a 5c 62 | 65 67 69 6e 7b 66 75 6e |ile)}.\b|egin{fun|
|00000500| 63 64 65 73 63 7d 7b 6f | 70 65 6e 7d 7b 66 69 6c |cdesc}{o|pen}{fil|
|00000510| 65 6e 61 6d 65 5c 6f 70 | 74 69 6f 6e 61 6c 7b 5c |ename\op|tional{\|
|00000520| 2c 20 6d 6f 64 65 5c 6f | 70 74 69 6f 6e 61 6c 7b |, mode\o|ptional{|
|00000530| 5c 2c 20 62 75 66 73 69 | 7a 65 7d 7d 7d 0a 20 43 |\, bufsi|ze}}}. C|
|00000540| 72 65 61 74 65 20 61 20 | 6e 65 77 20 70 6f 73 69 |reate a |new posi|
|00000550| 78 66 69 6c 65 20 6f 62 | 6a 65 63 74 20 77 69 74 |xfile ob|ject wit|
|00000560| 68 20 74 68 65 20 67 69 | 76 65 6e 20 66 69 6c 65 |h the gi|ven file|
|00000570| 6e 61 6d 65 20 61 6e 64 | 20 6d 6f 64 65 2e 20 20 |name and| mode. |
|00000580| 54 68 65 0a 20 5c 76 61 | 72 7b 66 69 6c 65 6e 61 |The. \va|r{filena|
|00000590| 6d 65 7d 2c 20 5c 76 61 | 72 7b 6d 6f 64 65 7d 20 |me}, \va|r{mode} |
|000005a0| 61 6e 64 20 5c 76 61 72 | 7b 62 75 66 73 69 7a 65 |and \var|{bufsize|
|000005b0| 7d 20 61 72 67 75 6d 65 | 6e 74 73 20 61 72 65 0a |} argume|nts are.|
|000005c0| 20 69 6e 74 65 72 70 72 | 65 74 65 64 20 74 68 65 | interpr|eted the|
|000005d0| 20 73 61 6d 65 20 77 61 | 79 20 61 73 20 62 79 20 | same wa|y as by |
|000005e0| 74 68 65 20 62 75 69 6c | 74 2d 69 6e 20 5c 63 6f |the buil|t-in \co|
|000005f0| 64 65 7b 6f 70 65 6e 28 | 29 7d 20 66 75 6e 63 74 |de{open(|)} funct|
|00000600| 69 6f 6e 2e 0a 5c 65 6e | 64 7b 66 75 6e 63 64 65 |ion..\en|d{funcde|
|00000610| 73 63 7d 0a 5c 62 65 67 | 69 6e 7b 66 75 6e 63 64 |sc}.\beg|in{funcd|
|00000620| 65 73 63 7d 7b 66 69 6c | 65 6f 70 65 6e 7d 7b 66 |esc}{fil|eopen}{f|
|00000630| 69 6c 65 6f 62 6a 65 63 | 74 7d 0a 20 43 72 65 61 |ileobjec|t}. Crea|
|00000640| 74 65 20 61 20 6e 65 77 | 20 70 6f 73 69 78 66 69 |te a new| posixfi|
|00000650| 6c 65 20 6f 62 6a 65 63 | 74 20 77 69 74 68 20 74 |le objec|t with t|
|00000660| 68 65 20 67 69 76 65 6e | 20 73 74 61 6e 64 61 72 |he given| standar|
|00000670| 64 20 66 69 6c 65 20 6f | 62 6a 65 63 74 2e 0a 20 |d file o|bject.. |
|00000680| 54 68 65 20 72 65 73 75 | 6c 74 69 6e 67 20 6f 62 |The resu|lting ob|
|00000690| 6a 65 63 74 20 68 61 73 | 20 74 68 65 20 73 61 6d |ject has| the sam|
|000006a0| 65 20 66 69 6c 65 6e 61 | 6d 65 20 61 6e 64 20 6d |e filena|me and m|
|000006b0| 6f 64 65 20 61 73 20 74 | 68 65 20 6f 72 69 67 69 |ode as t|he origi|
|000006c0| 6e 61 6c 0a 20 66 69 6c | 65 20 6f 62 6a 65 63 74 |nal. fil|e object|
|000006d0| 2e 0a 5c 65 6e 64 7b 66 | 75 6e 63 64 65 73 63 7d |..\end{f|uncdesc}|
|000006e0| 0a 54 68 65 20 70 6f 73 | 69 78 66 69 6c 65 20 6f |.The pos|ixfile o|
|000006f0| 62 6a 65 63 74 20 64 65 | 66 69 6e 65 73 20 74 68 |bject de|fines th|
|00000700| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 61 64 64 69 |e follow|ing addi|
|00000710| 74 69 6f 6e 61 6c 20 6d | 65 74 68 6f 64 73 3a 0a |tional m|ethods:.|
|00000720| 5c 72 65 6e 65 77 63 6f | 6d 6d 61 6e 64 7b 5c 69 |\renewco|mmand{\i|
|00000730| 6e 64 65 78 73 75 62 69 | 74 65 6d 7d 7b 28 70 6f |ndexsubi|tem}{(po|
|00000740| 73 69 78 66 69 6c 65 20 | 6d 65 74 68 6f 64 29 7d |sixfile |method)}|
|00000750| 0a 5c 62 65 67 69 6e 7b | 66 75 6e 63 64 65 73 63 |.\begin{|funcdesc|
|00000760| 7d 7b 6c 6f 63 6b 7d 7b | 66 6d 74 5c 2c 20 5c 6f |}{lock}{|fmt\, \o|
|00000770| 70 74 69 6f 6e 61 6c 7b | 6c 65 6e 5c 6f 70 74 69 |ptional{|len\opti|
|00000780| 6f 6e 61 6c 7b 5c 2c 20 | 73 74 61 72 74 0a 5c 6f |onal{\, |start.\o|
|00000790| 70 74 69 6f 6e 61 6c 7b | 5c 2c 20 77 68 65 6e 63 |ptional{|\, whenc|
|000007a0| 65 7d 7d 7d 7d 0a 20 4c | 6f 63 6b 20 74 68 65 20 |e}}}}. L|ock the |
|000007b0| 73 70 65 63 69 66 69 65 | 64 20 73 65 63 74 69 6f |specifie|d sectio|
|000007c0| 6e 20 6f 66 20 74 68 65 | 20 66 69 6c 65 20 74 68 |n of the| file th|
|000007d0| 61 74 20 74 68 65 20 66 | 69 6c 65 20 6f 62 6a 65 |at the f|ile obje|
|000007e0| 63 74 20 69 73 0a 20 72 | 65 66 65 72 72 69 6e 67 |ct is. r|eferring|
|000007f0| 20 74 6f 2e 20 20 54 68 | 65 20 66 6f 72 6d 61 74 | to. Th|e format|
|00000800| 20 69 73 20 65 78 70 6c | 61 69 6e 65 64 0a 20 62 | is expl|ained. b|
|00000810| 65 6c 6f 77 20 69 6e 20 | 61 20 74 61 62 6c 65 2e |elow in |a table.|
|00000820| 20 20 54 68 65 20 5c 76 | 61 72 7b 6c 65 6e 7d 20 | The \v|ar{len} |
|00000830| 61 72 67 75 6d 65 6e 74 | 20 73 70 65 63 69 66 69 |argument| specifi|
|00000840| 65 73 20 74 68 65 20 6c | 65 6e 67 74 68 20 6f 66 |es the l|ength of|
|00000850| 20 74 68 65 0a 20 73 65 | 63 74 69 6f 6e 20 74 68 | the. se|ction th|
|00000860| 61 74 20 73 68 6f 75 6c | 64 20 62 65 20 6c 6f 63 |at shoul|d be loc|
|00000870| 6b 65 64 2e 20 54 68 65 | 20 64 65 66 61 75 6c 74 |ked. The| default|
|00000880| 20 69 73 20 5c 63 6f 64 | 65 7b 30 7d 2e 20 5c 76 | is \cod|e{0}. \v|
|00000890| 61 72 7b 73 74 61 72 74 | 7d 0a 20 73 70 65 63 69 |ar{start|}. speci|
|000008a0| 66 69 65 73 20 74 68 65 | 20 73 74 61 72 74 69 6e |fies the| startin|
|000008b0| 67 20 6f 66 66 73 65 74 | 20 6f 66 20 74 68 65 20 |g offset| of the |
|000008c0| 73 65 63 74 69 6f 6e 2c | 20 77 68 65 72 65 20 74 |section,| where t|
|000008d0| 68 65 20 64 65 66 61 75 | 6c 74 20 69 73 0a 20 5c |he defau|lt is. \|
|000008e0| 63 6f 64 65 7b 30 7d 2e | 20 20 54 68 65 20 5c 76 |code{0}.| The \v|
|000008f0| 61 72 7b 77 68 65 6e 63 | 65 7d 20 61 72 67 75 6d |ar{whenc|e} argum|
|00000900| 65 6e 74 20 73 70 65 63 | 69 66 69 65 73 20 77 68 |ent spec|ifies wh|
|00000910| 65 72 65 20 74 68 65 20 | 6f 66 66 73 65 74 20 69 |ere the |offset i|
|00000920| 73 0a 20 72 65 6c 61 74 | 69 76 65 20 74 6f 2e 20 |s. relat|ive to. |
|00000930| 49 74 20 61 63 63 65 70 | 74 73 20 6f 6e 65 20 6f |It accep|ts one o|
|00000940| 66 20 74 68 65 20 63 6f | 6e 73 74 61 6e 74 73 20 |f the co|nstants |
|00000950| 5c 63 6f 64 65 7b 53 45 | 45 4b 5f 53 45 54 7d 2c |\code{SE|EK_SET},|
|00000960| 0a 20 5c 63 6f 64 65 7b | 53 45 45 4b 5f 43 55 52 |. \code{|SEEK_CUR|
|00000970| 7d 20 6f 72 20 5c 63 6f | 64 65 7b 53 45 45 4b 5f |} or \co|de{SEEK_|
|00000980| 45 4e 44 7d 2e 20 20 54 | 68 65 20 64 65 66 61 75 |END}. T|he defau|
|00000990| 6c 74 20 69 73 20 5c 63 | 6f 64 65 7b 53 45 45 4b |lt is \c|ode{SEEK|
|000009a0| 5f 53 45 54 7d 2e 0a 20 | 46 6f 72 20 6d 6f 72 65 |_SET}.. |For more|
|000009b0| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 61 62 6f | informa|tion abo|
|000009c0| 75 74 20 74 68 65 20 61 | 72 67 75 6d 65 6e 74 73 |ut the a|rguments|
|000009d0| 20 72 65 66 65 72 20 74 | 6f 20 74 68 65 20 66 63 | refer t|o the fc|
|000009e0| 6e 74 6c 0a 20 6d 61 6e | 75 61 6c 20 70 61 67 65 |ntl. man|ual page|
|000009f0| 20 6f 6e 20 79 6f 75 72 | 20 73 79 73 74 65 6d 2e | on your| system.|
|00000a00| 0a 5c 65 6e 64 7b 66 75 | 6e 63 64 65 73 63 7d 0a |.\end{fu|ncdesc}.|
|00000a10| 5c 62 65 67 69 6e 7b 66 | 75 6e 63 64 65 73 63 7d |\begin{f|uncdesc}|
|00000a20| 7b 66 6c 61 67 73 7d 7b | 5c 6f 70 74 69 6f 6e 61 |{flags}{|\optiona|
|00000a30| 6c 7b 66 6c 61 67 73 7d | 7d 0a 20 53 65 74 20 74 |l{flags}|}. Set t|
|00000a40| 68 65 20 73 70 65 63 69 | 66 69 65 64 20 66 6c 61 |he speci|fied fla|
|00000a50| 67 73 20 66 6f 72 20 74 | 68 65 20 66 69 6c 65 20 |gs for t|he file |
|00000a60| 74 68 61 74 20 74 68 65 | 20 66 69 6c 65 20 6f 62 |that the| file ob|
|00000a70| 6a 65 63 74 20 69 73 20 | 72 65 66 65 72 72 69 6e |ject is |referrin|
|00000a80| 67 0a 20 74 6f 2e 20 20 | 54 68 65 20 6e 65 77 20 |g. to. |The new |
|00000a90| 66 6c 61 67 73 20 61 72 | 65 20 4f 52 65 64 20 77 |flags ar|e ORed w|
|00000aa0| 69 74 68 20 74 68 65 20 | 6f 6c 64 20 66 6c 61 67 |ith the |old flag|
|00000ab0| 73 2c 20 75 6e 6c 65 73 | 73 20 73 70 65 63 69 66 |s, unles|s specif|
|00000ac0| 69 65 64 0a 20 6f 74 68 | 65 72 77 69 73 65 2e 20 |ied. oth|erwise. |
|00000ad0| 20 54 68 65 20 66 6f 72 | 6d 61 74 20 69 73 20 65 | The for|mat is e|
|00000ae0| 78 70 6c 61 69 6e 65 64 | 20 62 65 6c 6f 77 20 69 |xplained| below i|
|00000af0| 6e 20 61 20 74 61 62 6c | 65 2e 20 20 57 69 74 68 |n a tabl|e. With|
|00000b00| 6f 75 74 0a 20 74 68 65 | 20 5c 76 61 72 7b 66 6c |out. the| \var{fl|
|00000b10| 61 67 73 7d 20 61 72 67 | 75 6d 65 6e 74 0a 20 61 |ags} arg|ument. a|
|00000b20| 20 73 74 72 69 6e 67 20 | 69 6e 64 69 63 61 74 69 | string |indicati|
|00000b30| 6e 67 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 66 |ng the c|urrent f|
|00000b40| 6c 61 67 73 20 69 73 20 | 72 65 74 75 72 6e 65 64 |lags is |returned|
|00000b50| 20 28 74 68 69 73 20 69 | 73 0a 20 74 68 65 20 73 | (this i|s. the s|
|00000b60| 61 6d 65 20 61 73 20 74 | 68 65 20 27 3f 27 20 6d |ame as t|he '?' m|
|00000b70| 6f 64 69 66 69 65 72 29 | 2e 20 20 46 6f 72 20 6d |odifier)|. For m|
|00000b80| 6f 72 65 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |ore info|rmation |
|00000b90| 61 62 6f 75 74 20 74 68 | 65 20 66 6c 61 67 73 0a |about th|e flags.|
|00000ba0| 20 72 65 66 65 72 20 74 | 6f 20 74 68 65 20 66 63 | refer t|o the fc|
|00000bb0| 6e 74 6c 20 6d 61 6e 75 | 61 6c 20 70 61 67 65 20 |ntl manu|al page |
|00000bc0| 6f 6e 20 79 6f 75 72 20 | 73 79 73 74 65 6d 2e 0a |on your |system..|
|00000bd0| 5c 65 6e 64 7b 66 75 6e | 63 64 65 73 63 7d 0a 5c |\end{fun|cdesc}.\|
|00000be0| 62 65 67 69 6e 7b 66 75 | 6e 63 64 65 73 63 7d 7b |begin{fu|ncdesc}{|
|00000bf0| 64 75 70 7d 7b 7d 0a 20 | 44 75 70 6c 69 63 61 74 |dup}{}. |Duplicat|
|00000c00| 65 20 74 68 65 20 66 69 | 6c 65 20 6f 62 6a 65 63 |e the fi|le objec|
|00000c10| 74 20 61 6e 64 20 74 68 | 65 20 75 6e 64 65 72 6c |t and th|e underl|
|00000c20| 79 69 6e 67 20 66 69 6c | 65 20 70 6f 69 6e 74 65 |ying fil|e pointe|
|00000c30| 72 20 61 6e 64 20 66 69 | 6c 65 0a 20 64 65 73 63 |r and fi|le. desc|
|00000c40| 72 69 70 74 6f 72 2e 20 | 20 54 68 65 20 72 65 73 |riptor. | The res|
|00000c50| 75 6c 74 69 6e 67 20 6f | 62 6a 65 63 74 20 62 65 |ulting o|bject be|
|00000c60| 68 61 76 65 73 20 61 73 | 20 69 66 20 69 74 20 77 |haves as| if it w|
|00000c70| 65 72 65 20 6e 65 77 6c | 79 0a 20 6f 70 65 6e 65 |ere newl|y. opene|
|00000c80| 64 2e 0a 5c 65 6e 64 7b | 66 75 6e 63 64 65 73 63 |d..\end{|funcdesc|
|00000c90| 7d 0a 5c 62 65 67 69 6e | 7b 66 75 6e 63 64 65 73 |}.\begin|{funcdes|
|00000ca0| 63 7d 7b 64 75 70 32 7d | 7b 66 64 7d 0a 20 44 75 |c}{dup2}|{fd}. Du|
|00000cb0| 70 6c 69 63 61 74 65 20 | 74 68 65 20 66 69 6c 65 |plicate |the file|
|00000cc0| 20 6f 62 6a 65 63 74 20 | 61 6e 64 20 74 68 65 20 | object |and the |
|00000cd0| 75 6e 64 65 72 6c 79 69 | 6e 67 20 66 69 6c 65 20 |underlyi|ng file |
|00000ce0| 70 6f 69 6e 74 65 72 20 | 61 6e 64 20 66 69 6c 65 |pointer |and file|
|00000cf0| 0a 20 64 65 73 63 72 69 | 70 74 6f 72 2e 20 20 54 |. descri|ptor. T|
|00000d00| 68 65 20 6e 65 77 20 6f | 62 6a 65 63 74 20 77 69 |he new o|bject wi|
|00000d10| 6c 6c 20 68 61 76 65 20 | 74 68 65 20 67 69 76 65 |ll have |the give|
|00000d20| 6e 20 66 69 6c 65 20 64 | 65 73 63 72 69 70 74 6f |n file d|escripto|
|00000d30| 72 2e 0a 20 4f 74 68 65 | 72 77 69 73 65 20 74 68 |r.. Othe|rwise th|
|00000d40| 65 20 72 65 73 75 6c 74 | 69 6e 67 20 6f 62 6a 65 |e result|ing obje|
|00000d50| 63 74 20 62 65 68 61 76 | 65 73 20 61 73 20 69 66 |ct behav|es as if|
|00000d60| 20 69 74 20 77 65 72 65 | 20 6e 65 77 6c 79 20 6f | it were| newly o|
|00000d70| 70 65 6e 65 64 2e 0a 5c | 65 6e 64 7b 66 75 6e 63 |pened..\|end{func|
|00000d80| 64 65 73 63 7d 0a 5c 62 | 65 67 69 6e 7b 66 75 6e |desc}.\b|egin{fun|
|00000d90| 63 64 65 73 63 7d 7b 66 | 69 6c 65 7d 7b 7d 0a 20 |cdesc}{f|ile}{}. |
|00000da0| 52 65 74 75 72 6e 20 74 | 68 65 20 73 74 61 6e 64 |Return t|he stand|
|00000db0| 61 72 64 20 66 69 6c 65 | 20 6f 62 6a 65 63 74 20 |ard file| object |
|00000dc0| 74 68 61 74 20 74 68 65 | 20 70 6f 73 69 78 66 69 |that the| posixfi|
|00000dd0| 6c 65 20 6f 62 6a 65 63 | 74 20 69 73 20 62 61 73 |le objec|t is bas|
|00000de0| 65 64 0a 20 6f 6e 2e 20 | 20 54 68 69 73 20 69 73 |ed. on. | This is|
|00000df0| 20 73 6f 6d 65 74 69 6d | 65 73 20 6e 65 63 65 73 | sometim|es neces|
|00000e00| 73 61 72 79 20 66 6f 72 | 20 66 75 6e 63 74 69 6f |sary for| functio|
|00000e10| 6e 73 20 74 68 61 74 20 | 69 6e 73 69 73 74 20 6f |ns that |insist o|
|00000e20| 6e 20 61 0a 20 73 74 61 | 6e 64 61 72 64 20 66 69 |n a. sta|ndard fi|
|00000e30| 6c 65 20 6f 62 6a 65 63 | 74 2e 0a 5c 65 6e 64 7b |le objec|t..\end{|
|00000e40| 66 75 6e 63 64 65 73 63 | 7d 0a 41 6c 6c 20 6d 65 |funcdesc|}.All me|
|00000e50| 74 68 6f 64 73 20 72 65 | 74 75 72 6e 20 5c 63 6f |thods re|turn \co|
|00000e60| 64 65 7b 49 4f 45 72 72 | 6f 72 7d 20 77 68 65 6e |de{IOErr|or} when|
|00000e70| 20 74 68 65 20 72 65 71 | 75 65 73 74 20 66 61 69 | the req|uest fai|
|00000e80| 6c 73 2e 0a 46 6f 72 6d | 61 74 20 63 68 61 72 61 |ls..Form|at chara|
|00000e90| 63 74 65 72 73 20 66 6f | 72 20 74 68 65 20 5c 63 |cters fo|r the \c|
|00000ea0| 6f 64 65 7b 6c 6f 63 6b | 28 29 7d 20 6d 65 74 68 |ode{lock|()} meth|
|00000eb0| 6f 64 20 68 61 76 65 20 | 74 68 65 20 66 6f 6c 6c |od have |the foll|
|00000ec0| 6f 77 69 6e 67 20 6d 65 | 61 6e 69 6e 67 3a 0a 5c |owing me|aning:.\|
|00000ed0| 62 65 67 69 6e 7b 74 61 | 62 6c 65 69 69 69 7d 7b |begin{ta|bleiii}{|
|00000ee0| 7c 63 7c 6c 7c 63 7c 7d | 7b 73 61 6d 70 7d 7b 46 ||c|l|c|}|{samp}{F|
|00000ef0| 6f 72 6d 61 74 7d 7b 4d | 65 61 6e 69 6e 67 7d 7b |ormat}{M|eaning}{|
|00000f00| 7d 0a 20 20 5c 6c 69 6e | 65 69 69 69 7b 75 7d 7b |}. \lin|eiii{u}{|
|00000f10| 75 6e 6c 6f 63 6b 20 74 | 68 65 20 73 70 65 63 69 |unlock t|he speci|
|00000f20| 66 69 65 64 20 72 65 67 | 69 6f 6e 7d 7b 7d 0a 20 |fied reg|ion}{}. |
|00000f30| 20 5c 6c 69 6e 65 69 69 | 69 7b 72 7d 7b 72 65 71 | \lineii|i{r}{req|
|00000f40| 75 65 73 74 20 61 20 72 | 65 61 64 20 6c 6f 63 6b |uest a r|ead lock|
|00000f50| 20 66 6f 72 20 74 68 65 | 20 73 70 65 63 69 66 69 | for the| specifi|
|00000f60| 65 64 20 73 65 63 74 69 | 6f 6e 7d 7b 7d 0a 20 20 |ed secti|on}{}. |
|00000f70| 5c 6c 69 6e 65 69 69 69 | 7b 77 7d 7b 72 65 71 75 |\lineiii|{w}{requ|
|00000f80| 65 73 74 20 61 20 77 72 | 69 74 65 20 6c 6f 63 6b |est a wr|ite lock|
|00000f90| 20 66 6f 72 20 74 68 65 | 20 73 70 65 63 69 66 69 | for the| specifi|
|00000fa0| 65 64 20 73 65 63 74 69 | 6f 6e 7d 7b 7d 0a 5c 65 |ed secti|on}{}.\e|
|00000fb0| 6e 64 7b 74 61 62 6c 65 | 69 69 69 7d 0a 49 6e 20 |nd{table|iii}.In |
|00000fc0| 61 64 64 69 74 69 6f 6e | 20 74 68 65 20 66 6f 6c |addition| the fol|
|00000fd0| 6c 6f 77 69 6e 67 20 6d | 6f 64 69 66 69 65 72 73 |lowing m|odifiers|
|00000fe0| 20 63 61 6e 20 62 65 20 | 61 64 64 65 64 20 74 6f | can be |added to|
|00000ff0| 20 74 68 65 20 66 6f 72 | 6d 61 74 3a 0a 5c 62 65 | the for|mat:.\be|
|00001000| 67 69 6e 7b 74 61 62 6c | 65 69 69 69 7d 7b 7c 63 |gin{tabl|eiii}{|c|
|00001010| 7c 6c 7c 63 7c 7d 7b 73 | 61 6d 70 7d 7b 4d 6f 64 ||l|c|}{s|amp}{Mod|
|00001020| 69 66 69 65 72 7d 7b 4d | 65 61 6e 69 6e 67 7d 7b |ifier}{M|eaning}{|
|00001030| 4e 6f 74 65 73 7d 0a 20 | 20 5c 6c 69 6e 65 69 69 |Notes}. | \lineii|
|00001040| 69 7b 7c 7d 7b 77 61 69 | 74 20 75 6e 74 69 6c 20 |i{|}{wai|t until |
|00001050| 74 68 65 20 6c 6f 63 6b | 20 68 61 73 20 62 65 65 |the lock| has bee|
|00001060| 6e 20 67 72 61 6e 74 65 | 64 7d 7b 7d 0a 20 20 5c |n grante|d}{}. \|
|00001070| 6c 69 6e 65 69 69 69 7b | 3f 7d 7b 72 65 74 75 72 |lineiii{|?}{retur|
|00001080| 6e 20 74 68 65 20 66 69 | 72 73 74 20 6c 6f 63 6b |n the fi|rst lock|
|00001090| 20 63 6f 6e 66 6c 69 63 | 74 69 6e 67 20 77 69 74 | conflic|ting wit|
|000010a0| 68 20 74 68 65 20 72 65 | 71 75 65 73 74 65 64 20 |h the re|quested |
|000010b0| 6c 6f 63 6b 2c 20 6f 72 | 0a 20 20 20 20 20 20 20 |lock, or|. |
|000010c0| 20 20 20 20 20 20 20 5c | 63 6f 64 65 7b 4e 6f 6e | \|code{Non|
|000010d0| 65 7d 20 69 66 20 74 68 | 65 72 65 20 69 73 20 6e |e} if th|ere is n|
|000010e0| 6f 20 63 6f 6e 66 6c 69 | 63 74 2e 7d 7b 28 31 29 |o confli|ct.}{(1)|
|000010f0| 7d 20 0a 5c 65 6e 64 7b | 74 61 62 6c 65 69 69 69 |} .\end{|tableiii|
|00001100| 7d 0a 4e 6f 74 65 3a 0a | 28 31 29 20 54 68 65 20 |}.Note:.|(1) The |
|00001110| 6c 6f 63 6b 20 72 65 74 | 75 72 6e 65 64 20 69 73 |lock ret|urned is|
|00001120| 20 69 6e 20 74 68 65 20 | 66 6f 72 6d 61 74 20 5c | in the |format \|
|00001130| 63 6f 64 65 7b 28 6d 6f | 64 65 2c 20 6c 65 6e 2c |code{(mo|de, len,|
|00001140| 20 73 74 61 72 74 2c 0a | 77 68 65 6e 63 65 2c 20 | start,.|whence, |
|00001150| 70 69 64 29 7d 20 77 68 | 65 72 65 20 6d 6f 64 65 |pid)} wh|ere mode|
|00001160| 20 69 73 20 61 20 63 68 | 61 72 61 63 74 65 72 20 | is a ch|aracter |
|00001170| 72 65 70 72 65 73 65 6e | 74 69 6e 67 20 74 68 65 |represen|ting the|
|00001180| 20 74 79 70 65 20 6f 66 | 20 6c 6f 63 6b 0a 28 27 | type of| lock.('|
|00001190| 72 27 20 6f 72 20 27 77 | 27 29 2e 20 20 54 68 69 |r' or 'w|'). Thi|
|000011a0| 73 20 6d 6f 64 69 66 69 | 65 72 20 70 72 65 76 65 |s modifi|er preve|
|000011b0| 6e 74 73 20 61 20 72 65 | 71 75 65 73 74 20 66 72 |nts a re|quest fr|
|000011c0| 6f 6d 20 62 65 69 6e 67 | 20 67 72 61 6e 74 65 64 |om being| granted|
|000011d0| 3b 20 69 74 0a 69 73 20 | 66 6f 72 20 71 75 65 72 |; it.is |for quer|
|000011e0| 79 20 70 75 72 70 6f 73 | 65 73 20 6f 6e 6c 79 2e |y purpos|es only.|
|000011f0| 0a 46 6f 72 6d 61 74 20 | 63 68 61 72 61 63 74 65 |.Format |characte|
|00001200| 72 20 66 6f 72 20 74 68 | 65 20 5c 63 6f 64 65 7b |r for th|e \code{|
|00001210| 66 6c 61 67 73 28 29 7d | 20 6d 65 74 68 6f 64 20 |flags()}| method |
|00001220| 68 61 76 65 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |have the| followi|
|00001230| 6e 67 20 6d 65 61 6e 69 | 6e 67 3a 0a 5c 62 65 67 |ng meani|ng:.\beg|
|00001240| 69 6e 7b 74 61 62 6c 65 | 69 69 69 7d 7b 7c 63 7c |in{table|iii}{|c||
|00001250| 6c 7c 63 7c 7d 7b 73 61 | 6d 70 7d 7b 46 6f 72 6d |l|c|}{sa|mp}{Form|
|00001260| 61 74 7d 7b 4d 65 61 6e | 69 6e 67 7d 7b 7d 0a 20 |at}{Mean|ing}{}. |
|00001270| 20 5c 6c 69 6e 65 69 69 | 69 7b 61 7d 7b 61 70 70 | \lineii|i{a}{app|
|00001280| 65 6e 64 20 6f 6e 6c 79 | 20 66 6c 61 67 7d 7b 7d |end only| flag}{}|
|00001290| 0a 20 20 5c 6c 69 6e 65 | 69 69 69 7b 63 7d 7b 63 |. \line|iii{c}{c|
|000012a0| 6c 6f 73 65 20 6f 6e 20 | 65 78 65 63 20 66 6c 61 |lose on |exec fla|
|000012b0| 67 7d 7b 7d 0a 20 20 5c | 6c 69 6e 65 69 69 69 7b |g}{}. \|lineiii{|
|000012c0| 6e 7d 7b 6e 6f 20 64 65 | 6c 61 79 20 66 6c 61 67 |n}{no de|lay flag|
|000012d0| 20 28 61 6c 73 6f 20 63 | 61 6c 6c 65 64 20 6e 6f | (also c|alled no|
|000012e0| 6e 2d 62 6c 6f 63 6b 69 | 6e 67 20 66 6c 61 67 29 |n-blocki|ng flag)|
|000012f0| 7d 7b 7d 0a 20 20 5c 6c | 69 6e 65 69 69 69 7b 73 |}{}. \l|ineiii{s|
|00001300| 7d 7b 73 79 6e 63 68 72 | 6f 6e 69 7a 61 74 69 6f |}{synchr|onizatio|
|00001310| 6e 20 66 6c 61 67 7d 7b | 7d 0a 5c 65 6e 64 7b 74 |n flag}{|}.\end{t|
|00001320| 61 62 6c 65 69 69 69 7d | 0a 49 6e 20 61 64 64 69 |ableiii}|.In addi|
|00001330| 74 69 6f 6e 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |tion the| followi|
|00001340| 6e 67 20 6d 6f 64 69 66 | 69 65 72 73 20 63 61 6e |ng modif|iers can|
|00001350| 20 62 65 20 61 64 64 65 | 64 20 74 6f 20 74 68 65 | be adde|d to the|
|00001360| 20 66 6f 72 6d 61 74 3a | 0a 5c 62 65 67 69 6e 7b | format:|.\begin{|
|00001370| 74 61 62 6c 65 69 69 69 | 7d 7b 7c 63 7c 6c 7c 63 |tableiii|}{|c|l|c|
|00001380| 7c 7d 7b 73 61 6d 70 7d | 7b 4d 6f 64 69 66 69 65 ||}{samp}|{Modifie|
|00001390| 72 7d 7b 4d 65 61 6e 69 | 6e 67 7d 7b 4e 6f 74 65 |r}{Meani|ng}{Note|
|000013a0| 73 7d 0a 20 20 5c 6c 69 | 6e 65 69 69 69 7b 21 7d |s}. \li|neiii{!}|
|000013b0| 7b 74 75 72 6e 20 74 68 | 65 20 73 70 65 63 69 66 |{turn th|e specif|
|000013c0| 69 65 64 20 66 6c 61 67 | 73 20 27 6f 66 66 27 2c |ied flag|s 'off',|
|000013d0| 20 69 6e 73 74 65 61 64 | 20 6f 66 20 74 68 65 20 | instead| of the |
|000013e0| 64 65 66 61 75 6c 74 20 | 27 6f 6e 27 7d 7b 28 31 |default |'on'}{(1|
|000013f0| 29 7d 0a 20 20 5c 6c 69 | 6e 65 69 69 69 7b 3d 7d |)}. \li|neiii{=}|
|00001400| 7b 72 65 70 6c 61 63 65 | 20 74 68 65 20 66 6c 61 |{replace| the fla|
|00001410| 67 73 2c 20 69 6e 73 74 | 65 61 64 20 6f 66 20 74 |gs, inst|ead of t|
|00001420| 68 65 20 64 65 66 61 75 | 6c 74 20 27 4f 52 27 20 |he defau|lt 'OR' |
|00001430| 6f 70 65 72 61 74 69 6f | 6e 7d 7b 28 31 29 7d 0a |operatio|n}{(1)}.|
|00001440| 20 20 5c 6c 69 6e 65 69 | 69 69 7b 3f 7d 7b 72 65 | \linei|ii{?}{re|
|00001450| 74 75 72 6e 20 61 20 73 | 74 72 69 6e 67 20 69 6e |turn a s|tring in|
|00001460| 20 77 68 69 63 68 20 74 | 68 65 20 63 68 61 72 61 | which t|he chara|
|00001470| 63 74 65 72 73 20 72 65 | 70 72 65 73 65 6e 74 20 |cters re|present |
|00001480| 74 68 65 20 66 6c 61 67 | 73 20 74 68 61 74 0a 20 |the flag|s that. |
|00001490| 20 61 72 65 20 73 65 74 | 2e 7d 7b 28 32 29 7d 0a | are set|.}{(2)}.|
|000014a0| 5c 65 6e 64 7b 74 61 62 | 6c 65 69 69 69 7d 0a 4e |\end{tab|leiii}.N|
|000014b0| 6f 74 65 3a 0a 28 31 29 | 20 54 68 65 20 5c 63 6f |ote:.(1)| The \co|
|000014c0| 64 65 7b 21 7d 20 61 6e | 64 20 5c 63 6f 64 65 7b |de{!} an|d \code{|
|000014d0| 3d 7d 20 6d 6f 64 69 66 | 69 65 72 73 20 61 72 65 |=} modif|iers are|
|000014e0| 20 6d 75 74 75 61 6c 6c | 79 20 65 78 63 6c 75 73 | mutuall|y exclus|
|000014f0| 69 76 65 2e 0a 28 32 29 | 20 54 68 69 73 20 73 74 |ive..(2)| This st|
|00001500| 72 69 6e 67 20 72 65 70 | 72 65 73 65 6e 74 73 20 |ring rep|resents |
|00001510| 74 68 65 20 66 6c 61 67 | 73 20 61 66 74 65 72 20 |the flag|s after |
|00001520| 74 68 65 79 20 6d 61 79 | 20 68 61 76 65 20 62 65 |they may| have be|
|00001530| 65 6e 20 61 6c 74 65 72 | 65 64 0a 62 79 20 74 68 |en alter|ed.by th|
|00001540| 65 20 73 61 6d 65 20 63 | 61 6c 6c 2e 0a 45 78 61 |e same c|all..Exa|
|00001550| 6d 70 6c 65 73 3a 0a 5c | 62 63 6f 64 65 5c 62 65 |mples:.\|bcode\be|
|00001560| 67 69 6e 7b 76 65 72 62 | 61 74 69 6d 7d 0a 66 72 |gin{verb|atim}.fr|
|00001570| 6f 6d 20 70 6f 73 69 78 | 66 69 6c 65 20 69 6d 70 |om posix|file imp|
|00001580| 6f 72 74 20 2a 0a 66 69 | 6c 65 20 3d 20 6f 70 65 |ort *.fi|le = ope|
|00001590| 6e 28 27 2f 74 6d 70 2f | 74 65 73 74 27 2c 20 27 |n('/tmp/|test', '|
|000015a0| 77 27 29 0a 66 69 6c 65 | 2e 6c 6f 63 6b 28 27 77 |w').file|.lock('w|
|000015b0| 7c 27 29 0a 66 69 6c 65 | 2e 6c 6f 63 6b 28 27 75 ||').file|.lock('u|
|000015c0| 27 29 0a 66 69 6c 65 2e | 63 6c 6f 73 65 28 29 0a |').file.|close().|
|000015d0| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 5c 65 |\end{ver|batim}\e|
|000015e0| 63 6f 64 65 0a | |code. | |
+--------+-------------------------+-------------------------+--------+--------+